package com.yunhe.history.client.fallback;

import com.yunhe.history.client.AuthorityClient;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.util.FallbackUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

/**
 * @author liuronglei
 */
@Component
public class AuthorityFallbackFactory implements FallbackFactory<AuthorityClient> {
    @Override
    public AuthorityClient create(Throwable arg0) {
        return new AuthorityClient() {
            @Override
            public ResponseEntity<ResultObject<String>> getTimeZoneId(Long stationCode) {
                return FallbackUtil.getDefaultFallBack();
            }
        };
    }
}
